package com.example.wallet.controller;

import com.example.wallet.entity.ResultVO;
import com.example.wallet.entity.Wallet;
import com.example.wallet.service.IWalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WalletController {

    @Autowired
    IWalletService walletService;

    /**
     * 查询用户钱包余额
     * @param userId 用户id
     * @return 钱包信息（包含余额）
     */
    @GetMapping("/balanceInquiry")
    public ResultVO<Wallet> balanceInquiry(@RequestParam("userId") Integer userId){
        Wallet wallet = walletService.balanceInquiry(userId);
        return new ResultVO<>(200,"查询成功",wallet);
    }
}
